﻿@{
    Layout = null;
}

<link href="~/libs/layui-v2.9.21/layui-v2.9.21/layui/css/layui.css" rel="stylesheet" />

<form class="layui-form layui-form-pane" action="">

    <div class="layui-form-item">
        <label class="layui-form-label">仓库名称</label>
        <div class="layui-input-block">
            <input type="text" name="warehouse" lay - verify="required" placeholder="请输入仓库名称" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">储位类型</label>
        <div class="layui-input-block">
            <input type="text" name="locationType" lay - verify="required" placeholder="请输入储位类型" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">储位编码</label>
        <div class="layui-input-block">
            <input type="text" name="location" lay - verify="required" placeholder="请输入储位编码" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属客户</label>
        <div class="layui-input-block">
            <input type="text" name="customer" lay - verify="required" placeholder="请输入所属客户" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">最大体积</label>
        <div class="layui-input-block">
            <input type="number" step="0.01" name="maxVolume" lay - verify="required" placeholder="请输入最大体积"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上架次序</label>
        <div class="layui-input-block">
            <input type="text" name="shelvingSequence" lay - verify="required" placeholder="请输入上架次序" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">长度(单位：CM)</label>
        <div class="layui-input-block">
            <input type="number" name="lengthCM" lay - verify="required" placeholder="请输入长度" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">宽度(单位：CM)</label>
        <div class="layui-input-block">
            <input type="number" name="widthCM" lay - verify="required" placeholder="请输入宽度" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">高度(单位：CM)</label>
        <div class="layui-input-block">
            <input type="number" name="heightCM" lay - verify="required" placeholder="请输入高度" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">最大托盘</label>
        <div class="layui-input-block">
            <input type="number" name="maxPallet" lay - verify="required" placeholder="请输入最大托盘" autocomplete="off"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="demo2">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>
<script src="~/libs/layui-v2.9.21/layui-v2.9.21/layui/layui.js"></script>
<script src="~/libs/jquery/jquery.js"></script>
<script>
    layui.use(['form'], function () {
      var form = layui.form;
      var layer = layui.layer;
              // 提交事件
              form.on('submit(demo2)', function (data) {
                console.log(data); // 当前容器的全部表单字段，名值对形式：{name: value}
                var field = data.field; // 获取表单字段值

                    $.ajax({
                                url:"/OtherInbound/AddOtherInbound",
                                data:field,
                                type:"post",
                                dataType:"json",
                                success:function(res){
                                    console.log(res)
                                    if(res>0)
                                    {
                                       alert("添加成功")
                                       // 刷新父页面表格
                                        parent.layui.table.reload('Table');
                                        // 关闭弹窗
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    }
                                    else
                                    {
                                        alert("添加失败")
                                    }
                                }
                            })

                return false; // 阻止默认 form 跳转
              });


          //      单位
          // var unit = function(){
          //       $.ajax({
          //           url: "/CommodityDetail/GetDictItemById",
          //           type: "get",
          //           dataType: "json",
          //           data: { id: 1 },
          //           success: function (res) {
          //               console.log(res)
          //               var data = res;
          //               var html = "";
          //               for (var i = 0; i < data.length; i++) {
          //                   html += "<option value='" + data[i].sortId + "'>" + data[i].dictItemName + "</option>";
          //               }
          //               $("#unit").html(html);
          //               form.render('select');
          //           }
          //       });
          //  }

          //  unit();
    });
</script> 